<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun(){
				let r = Math.floor(Math.random()*256)
				let g = Math.floor(Math.random()*256)
				let b = Math.floor(Math.random()*256)
				let color =`rgb(${r},${g},${b})`
				document.querySelector("span").innerHTML=color
				document.body.setAttribute("style",`background-color:${color}`)
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="fun()">随机背景色</button>
		<span></span>
	</body>
</html>
